(function() {
    'use strict';
    angular.module('weApp.controllers')
            //帮助中心
            .controller('helpCtrl', ['$scope', '$rootScope', '$state', '$stateParams', '$timeout', '$http', 'weAppDataBase', 'showLinePageService', 'localStorageService', 'myFavorsService',
                function($scope, $rootScope, $state, $stateParams, $timeout, $http, weAppDataBase, showLinePageService, localStorageService, myFavorsService) {

                    var rootReq = {
                        method: 'post',
                        url: $rootScope.rootLocation + '/line/bus/feedbackList',
                        data: {
                            "cityName": $rootScope.cityName,
                            "cityCode": $rootScope.cityCode,
                            "problemType": '2'
                        }
                    };

                    $http(rootReq).then(function(helps) {
                        if (helps.data.head.success == "true") {
                            var help = helps.data.data.problems;
                            for (var i in help) {
                                help[i].commTitles = help[i].commTitle;
                                if (i >= 0) {
                                    if (help[i].commTitle.length > 16) {
                                        help[i].commTitle = help[i].commTitle.slice(0, 14) + "...";
                                    }

                                }
                            }

                            $rootScope.help = help;
                        }

                    });

                    $scope.btn = function(title, text, titles) {
                        $rootScope.text = text;
                        $rootScope.titles = titles;
                        localStorageService.set("helpTit", titles);
                        localStorageService.set("helpTxt", text);
                    }

                }]);
})();